package com.yanduo.tools

/**
  * @author Gerry chan
  * @version 1.0
  */
object NBF {

  /**
    * 字符串转Int
    * @param str
    * @return
    */
  def toInt(str: String): Int = {
    try {
      str.toInt
    } catch {
      case _:Exception => 0
    }
  }

  /**
    *
    * @param str
    * @return
    */
  def toDouble(str: String): Double = {
    try {
      str.toDouble
    } catch {
      case _:Exception => 0.0
    }
  }
}
